﻿using System;
using System.Data.SqlClient;

namespace Autorun
{
	[Serializable()]
	public class Information : MarshalByRefObject
	{
        #region "Singleton Design-Pattern"
		private static Information _instance = new Information();

		public static Information Instance
		{
			get { return _instance; }
		}
		#endregion

		#region "Properties"
		public string MachineName
		{
			get { return Environment.MachineName; }
		}

		public string Domain
		{
			get { return AppDomain.CurrentDomain.FriendlyName; }
		}

		public Version Version
		{
			get { return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; }
		}

		public String HomeDirectory
		{
			get { return Environment.CurrentDirectory; }
		}

		public string Database
		{
			get
            {
                SqlConnection cn;

                cn = new SqlConnection(Properties.Settings.Default.ConnectionString);
                
                return string.Format("{0}@{1}", cn.Database, cn.DataSource); 
            }
		}
		#endregion
	}
}
